class H:
    def __init__(self):
        print('类初始化')
    def __str__(self):
        return 'hasaki'

>>>h=H()
>>>类初始化
>>>print(h)
>>>hasaki
>>>h.__str__()
>>>hasaki